package com.erlang.spring.dao.impl;

import com.erlang.spring.dao.AccountDao;
import com.erlang.spring.pojo.Account;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

/**
 * @Description：账户dao接口,实现类
 */
public class AccountDaoImpl implements AccountDao {

  private JdbcTemplate jdbcTemplate;

  @Override
  public List<Account> findAll() {
    String sql = "select * from jt_account";
    return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(Account.class));
  }

  public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
    this.jdbcTemplate = jdbcTemplate;
  }
}